package ch.subgate.chessvisualizationtrainer.utils;

public class CVTHelper {
	
	/** Used to get the human readable square coordinate */
	public static String getReadableSquare(int x, int y) {
		switch (x) {
			case 1:
				return "a" + y;
			case 2:
				return "b" + y;
			case 3:
				return "c" + y;
			case 4:
				return "d" + y;
			case 5:
				return "e" + y;
			case 6:
				return "f" + y;
			case 7:
				return "g" + y;
			case 8:
				return "h" + y;
			default:
				return null;
		}
	}
	
	public static float getDeltaScore(float difficulty, float dt) {
		if (dt < difficulty) {
			return 10.0f;
		}
		else {
			return (10.0f * difficulty) / dt;
		}
	}
	
	public static boolean isDiagonal(int x1, int y1, int x2, int y2) {
		if (Math.abs(x1 - x2) == Math.abs(y1 - y2)) {
			return true;
		}
		else {
			return false;
		}
	}
	
	public static boolean isKnightMove(int x1, int y1, int x2, int y2) {
		if (Math.abs(x1 - x2) + Math.abs(y1 - y2) == 3 && (Math.abs(x1 - x2) == 1 || Math.abs(y1 - y2) == 1)) {
			return true;
		}
		else {
			return false;
		}
	}
	
}
